﻿@{Layout = null;}
<html>
<head>
    <title>AFLAX: The AJAX Library for the Adobe Flash&trade; Platform</title>
    <script src="/Scripts/jquery-1.5.1.js" type="text/javascript"></script>
    <script type="text/javascript" src="/AFLAX/aflax.js"></script>
    <script type="text/javascript">
        var aflax = new AFLAX("/AFLAX/aflax.swf");
        var connection = null;
        function go() {
            connection = new AFLAX.Socket(aflax, "127.0.0.1", 5555, "onConnectEvent", "onDataEvent", "onCloseEvent");
            //connection.send("<command>asfasasf</command>\0");
        }

        function onConnectEvent(val) {
            console.log(val);
        }

        function onDataEvent(str) {
            //console.log(str);
            $("#result").html('<p>'+str+'</p>');
        }

        function onCloseEvent() {
            console.log("the connection is already closed");
        }
        function send() {
            //connection.send("1");
            $.post('/Aflax/SocketTest', function (result) {
                //alert(result);
            });
        }

    </script>
</head>
<body>
    <div>
        <script type="text/javascript">
            aflax.insertFlash(1, 1, "#ffffff", "go", true);
        </script>
    </div>
    <div>
        <a href="javascript:void(0);" onclick="send();">发送</a></div>
        <div id="result"></div>
</body>
</html>
